<template>
  <div class="pay" v-if="userInfo">
    <my-header title="在线支付">
      <template #right>
        <slot name="right"> &nbsp; </slot>
      </template>
    </my-header>

    <!-- 倒计时 -->
    <div class="backnumber">
      <van-count-down :time="time">
        <template #default="timeData">
          <div class="timewrap">
            <p class="text">剩余支付时间</p>
            <p class="time">
              <span class="block">{{ timeData.minutes }}</span>
              <span class="colon">:</span>
              <span class="block">{{ timeData.seconds }}</span>
            </p>
          </div>
        </template>
      </van-count-down>
    </div>
    <!-- 总计 -->
    <p class="total">￥{{ this.$route.query.total }}</p>

    <!-- 支付方式 -->
    <div class="paymode">
      <van-cell-group>
        <van-cell title="支付方式" />
        <van-radio-group v-model="radio">
          <van-radio name="1">
            <i class="iconfont icon-zhifubao"></i>
            <span class="custom-title">支付宝</span>
          </van-radio>
          <van-radio name="2">
            <i class="iconfont icon-weixinzhifu"></i>
            <span class="custom-title">微信支付</span>
          </van-radio>
          <van-radio name="3">
            <i class="iconfont icon-yinlian"></i>
            <span class="custom-title">银联</span>
          </van-radio>
          <van-radio name="4">
            <i class="iconfont icon-zhifupingtai-master"></i>
            <span class="custom-title">万事达</span>
          </van-radio>
        </van-radio-group>
      </van-cell-group>
    </div>

    <!-- footer -->
    <div class="next">
      <van-cell>
        <template #title>
          <span class="paynext" @click="showPopup"
            >下一步，支付￥{{ $route.query.total }}</span
          >
          <van-popup v-model="show">
            <div v-if="radio==1">
              <img src="../../assets/images/alipay.png" alt="">
            </div>
            <div v-else-if="radio==2">
              微信
            </div>
            <div v-else-if="radio==3">
              银联
            </div>
            <div v-else-if="radio==4">
              万事达
            </div>
          </van-popup>
        </template>
      </van-cell>
    </div>
  </div>

  <div v-else>
    请先登录
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 单位为毫秒
      time: 30 * 60 * 2 * 1000,
      radio: "1",
      show:false,
    };
  },
  methods: {
    showPopup() {
      this.show = true;
    },
  },
  mounted() {},
};
</script>


<style lang="scss" scoped>
.pay {
  width: 100%;
  // height: 100vh;
  background: #eee;
  .backnumber {
    width: 100%;
    .timewrap {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      height: 100px;
      background: #eee;
      .text {
        font-size: 14px;
      }
      .time {
        margin-top: 15px;
        font-size: 24px;
      }
    }
  }
  .total {
    color: #ff80aa;
    padding: 0 15px;
    height: 40px;
    line-height: 40px;
    background: #fff;
  }
  .paymode {
    border-top: 8px solid #eee;
    ::v-deep .van-radio {
      // width: 100%;
      display: flex;
      align-items: center;
      height: 40px;
      margin-left: 15px;
    }
    ::v-deep .van-radio__label {
      display: flex;
      align-items: center;
      margin-left: 10px;
    }
    .iconfont {
      margin-left: 0;
    }
    .icon-zhifubao {
      color: #4d79ff;
      font-size: 40px;
    }
    .icon-weixinzhifu {
      color: #00e600;
      font-size: 40px;
    }
    .icon-yinlian {
      color: #e680ff;
      font-size: 40px;
    }
    .icon-zhifupingtai-master {
      color: peru;
      font-size: 30px;
    }
  }
  .next {
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    img{
      width: 100%;
      height: 100%;
    }
    span {
      display: inline-block;
      width: 90%;
      color: #fff;
      height: 40px;
      line-height: 40px;
      background: linear-gradient(to left, #e680ff, #ff80aa);
      border-radius: 20px;
    }
  }
}
</style>